/* ============ 下拉菜单容器 ============ */

.dropdown-wrapper {
    position: relative;
    display: block;
    width: 100%;
    max-width: 300px;
    z-index: 100;
}

/* ============ 选择框 ============ */

.dropdown-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-white);
    cursor: pointer;
    transition: var(--transition);
    min-height: 36px;
}

.dropdown-selector:hover:not(.disabled) {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.dropdown-selector.open {
    border-color: var(--primary-color);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.dropdown-selector.disabled {
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.selector-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selector-arrow {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 8px;
    transition: transform 0.2s;
}

.dropdown-selector.open .selector-arrow {
    transform: rotate(180deg);
}

.clear-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    margin-right: 4px;
    transition: var(--transition);
}

.clear-btn:hover {
    color: var(--text-primary);
}

/* ============ 下拉菜单 ============ */

.dropdown-menu {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-height: 300px;
    overflow-y: auto;
    min-width: 100%;
}

/* ============ 搜索框 ============ */

.dropdown-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-white);
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

/* ============ 选项列表 ============ */

.dropdown-options {
    padding: 4px 0;
}

.option-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============ 分组 ============ */

.option-group {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    background: var(--bg-light);
}

/* ============ 单个选项 ============ */

.dropdown-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: var(--transition);
    gap: 8px;
}

.dropdown-option:not(.disabled):hover {
    background: var(--bg-light);
}

.dropdown-option.selected {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-color);
}

.dropdown-option.disabled {
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

.option-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-label {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.option-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
    white-space: nowrap;
}

/* ============ 响应式 ============ */

@media (max-width: 768px) {
    .dropdown-wrapper {
        max-width: 100%;
    }

    .dropdown-menu {
        max-height: 250px;
    }

    .dropdown-option {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .dropdown-selector {
        padding: 8px 10px;
        min-height: 32px;
    }

    .selector-text {
        font-size: 13px;
    }

    .dropdown-menu {
        max-height: 200px;
    }

    .option-label {
        font-size: 13px;
    }

    .option-description {
        font-size: 11px;
    }
}

/* ============ 滚动条样式 ============ */

.dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
